package net.betou.trade.main.manager;

import java.util.List;
import java.util.Set;

import net.betou.common.page.Pagination;
import net.betou.trade.entity.main.AgentAndAdmins;
import net.betou.trade.entity.main.Role;

/**
 * 居间商角色
 * @deprecated
 * @author 叶装装
 */
public interface RoleMng{

	/**
	 * 根据ID查找
	 * 
	 * @param id
	 * @return
	 */
	public Role findById( Integer id );

	/**
	 * 按等级查找
	 * 
	 * @param level
	 * @param searchProperty
	 * @param searchValue
	 * @param orderProperty
	 * @param orderDirection
	 * @return
	 */
	public List< Role > getAdminRoleList( Integer level, String searchProperty, String searchValue, String orderProperty, String orderDirection );

	/**
	 * 获取管理员角色列表
	 * 
	 * @param searchProperty
	 * @param searchValue
	 * @param orderProperty
	 * @param orderDirection
	 * @return
	 */
	public List< Role > getAdminRoleList( String searchProperty, String searchValue, String orderProperty, String orderDirection );

	/**
	 * 获取居间商角色列表
	 * 
	 * @param searchProperty
	 * @param searchValue
	 * @param orderProperty
	 * @param orderDirection
	 * @return
	 * @deprecated
	 */
	public List< Role > getAgentRoleList( String searchProperty, String searchValue, String orderProperty, String orderDirection );
	
	/**
	 * 查找自己的可操作角色
	 * @param selfId
	 * @return
	 */
	public List< Role > getAgentRoleList( AgentAndAdmins admin );

	/**
	 * 查找分页数据
	 * 
	 * @param admin
	 * @param searchProperty
	 * @param searchValue
	 * @param orderProperty
	 * @param orderDirection
	 * @return
	 */
	public Pagination getAgentPage( AgentAndAdmins admin, String searchProperty, String searchValue, String orderProperty, String orderDirection, int pageSize, int pageNo );

	/**
	 * 查找系统角色
	 * 
	 * @param id
	 * @return
	 */
	public Role findAdminRole( Integer id );

	/**
	 * 查找居间商角色
	 * 
	 * @param id
	 * @return
	 */
	public Role findAgentRole( AgentAndAdmins admin, Integer id );

	/**
	 * 更新
	 * 
	 * @param bean
	 *            角色
	 * @param perms
	 *            角色权限
	 * @return
	 */
	public Role update( Role bean, Set< String > perms );

	/**
	 * 删除
	 * 
	 * @param id
	 * @return
	 */
	public Role deleteById( Integer id );

	/**
	 * 批量删除
	 * 
	 * @param ids
	 * @return
	 */
	public Role [ ] deleteByIds( Integer [ ] ids );

	
	/**
	 * 查找机构默认角色
	 * @return
	 */
	public Role findAgency( );
	
	/**
	 * 查找代理默认角色
	 * @return
	 */
	public Role findProxy( );

	public Role findMyAgency( Integer selfId );
	
	public Role findMyProxy( Integer selfId );
	
	/**
	 * 查找>=当前level的role
	 * 
	 * @param level
	 * @return
	 * @deprecated
	 */
	public List< Role > getAgentRoleList( Integer level );
	
	/**
	 * 查找默认的角色或者当前用户的角色列表
	 * @param admin
	 * @return
	 */
	public List< Role > getAgentRoleAndDefaultList( AgentAndAdmins admin );

	/**
	 * 添加管理员角色
	 * 
	 * @param bean
	 * @param perms
	 * @return
	 */
	public Role saveAdminRole( Role bean, Set< String > perms );

	/**
	 * 添加居间商角色
	 * 
	 * @param bean
	 * @param perms
	 * @return
	 */
	public Role saveAgentRole( AgentAndAdmins admin, Role bean, Set< String > perms );

}
